Namespace Blog
    Public Class Comment

        Dim _Id As Integer
        Dim _Deleted As Boolean

        ' Info on the person who submitted the comments
        Dim _Name As String
        Dim _MailAddress As Net.Mail.MailAddress
        Dim _IPAddress As Net.IPAddress

        ' Info on the comment
        Dim _BlogPost As Integer
        Dim _Message As String
        Dim _DateSubmitted As Date
        Dim _Rating As Integer

        Public Property Id() As String
            Get
                Return _Id
            End Get
            Set(ByVal value As String)
                _Id = value
            End Set
        End Property

        Public Property Name() As String
            Get
                Return _Name
            End Get
            Set(ByVal value As String)
                _Name = value
            End Set
        End Property

        Public Property MailAddress() As Net.Mail.MailAddress
            Get
                Return _MailAddress
            End Get
            Set(ByVal value As Net.Mail.MailAddress)
                _MailAddress = value
            End Set
        End Property

        Public Property IPAddress() As Net.IPAddress
            Get
                Return _IPAddress
            End Get
            Set(ByVal value As Net.IPAddress)
                _IPAddress = value
            End Set
        End Property

        Public Property BlogPost() As Integer
            Get
                Return _BlogPost
            End Get
            Set(ByVal value As Integer)
                _BlogPost = value
            End Set
        End Property

        Public Property Message() As String
            Get
                Return _Message
            End Get
            Set(ByVal value As String)
                _Message = value
            End Set
        End Property

        Public Property DateSubmitted() As Date
            Get
                Return _DateSubmitted
            End Get
            Set(ByVal value As Date)
                _DateSubmitted = value
            End Set
        End Property

        Public Property Rating() As Integer
            Get
                Return _Rating
            End Get
            Set(ByVal value As Integer)
                _Rating = value
            End Set
        End Property


        Public Class SortByNewestFirstComparer
            Implements Collections.Generic.IComparer(Of Comment)

            Public Function Compare(ByVal x As Comment, ByVal y As Comment) As Integer Implements System.Collections.Generic.IComparer(Of Comment).Compare
                Return Date.Compare(x.DateSubmitted, y.DateSubmitted)
            End Function

        End Class
        Public Class SortByOldestFirstComparer
            Implements Collections.Generic.IComparer(Of Comment)

            Public Function Compare(ByVal x As Comment, ByVal y As Comment) As Integer Implements System.Collections.Generic.IComparer(Of Comment).Compare
                Return Date.Compare(y.DateSubmitted, x.DateSubmitted)
            End Function

        End Class
        Public Class SortByIdComparer
            Implements Collections.Generic.IComparer(Of Comment)

            Public Function Compare(ByVal x As Comment, ByVal y As Comment) As Integer Implements System.Collections.Generic.IComparer(Of Comment).Compare
                If x.Id < y.Id Then Return -1
                If x.Id = y.Id Then Return 0
                If x.Id > y.Id Then Return 1
            End Function

        End Class
        Public Class SortByBestRatingComparer
            Implements Collections.Generic.IComparer(Of Comment)

            Public Function Compare(ByVal x As Comment, ByVal y As Comment) As Integer Implements System.Collections.Generic.IComparer(Of Comment).Compare
                If x.Rating < y.Rating Then Return -1
                If x.Rating = y.Rating Then Return 0
                If x.Rating > y.Rating Then Return 1
            End Function

        End Class
        Public Class SortByWorstRatingComparer
            Implements Collections.Generic.IComparer(Of Comment)

            Public Function Compare(ByVal x As Comment, ByVal y As Comment) As Integer Implements System.Collections.Generic.IComparer(Of Comment).Compare
                If x.Rating < y.Rating Then Return -1
                If x.Rating = y.Rating Then Return 0
                If x.Rating > y.Rating Then Return 1
            End Function

        End Class

    End Class
End Namespace